// DVBDescDialog.cpp : implementation file
//

#include "stdafx.h"
#include "TSG.h"
#include "DVBDescDialog.h"


// CDVBDescDialog dialog

IMPLEMENT_DYNAMIC(CDVBDescDialog, CDialog)

CDVBDescDialog::CDVBDescDialog(CWnd* pParent /*=NULL*/)
	: CDialog(CDVBDescDialog::IDD, pParent)
{

}

CDVBDescDialog::~CDVBDescDialog()
{
}

void CDVBDescDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CDVBDescDialog, CDialog)
	ON_WM_CTLCOLOR()
	ON_WM_SIZE()
END_MESSAGE_MAP()


// CDVBDescDialog message handlers

HBRUSH CDVBDescDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

	// TODO:  Change any attributes of the DC here
	if(nCtlColor == CTLCOLOR_DLG)
	{
		hbr = CreateSolidBrush(RGB(255,255,255));
	}

	// TODO:  Return a different brush if the default is not desired
	return hbr;
}

void CDVBDescDialog::OnSize(UINT nType, int cx, int cy)
{
	CDialog::OnSize(nType, cx, cy);

	// TODO: Add your message handler code here
	CRect rc;
	
	if(GetDlgItem(IDC_TREE_DESC))
	{	
		GetClientRect(&rc);
		rc.left += rc.Width()/4 + 5;
		rc.top += 10;
		rc.right -=5;
		rc.bottom -= 30;
		GetDlgItem(IDC_TREE_DESC)->MoveWindow(rc);
	}
	if(GetDlgItem(IDC_LIST_DESC))
	{
		GetClientRect(&rc);
		rc.left += 5;
		rc.top	+= 10;
		rc.right = rc.Width()/4 - 5;
		rc.bottom -= 30;
		GetDlgItem(IDC_LIST_DESC)->MoveWindow(rc);
	}
	if(GetDlgItem(IDC_BUT_DESC_APPLY))
	{
		CRect rcBut;
		GetClientRect(&rc);
		GetDlgItem(IDC_BUT_DESC_APPLY)->GetClientRect(&rcBut);
		rc.left = rc.right - 100;
		rc.top = rc.bottom - 25;
		rc.right = rc.left+rcBut.Width();
		rc.bottom = rc.top + rcBut.Height();
		GetDlgItem(IDC_BUT_DESC_APPLY)->MoveWindow(rc);
	}
	if(GetDlgItem(IDC_BUT_NEW_DESC))
	{
		CRect rcBut;
		GetClientRect(&rc);
		GetDlgItem(IDC_BUT_NEW_DESC)->GetClientRect(&rcBut);
		rc.left = rc.right - 200;
		rc.top = rc.bottom - 25;
		rc.right = rc.left+rcBut.Width();
		rc.bottom = rc.top + rcBut.Height();
		GetDlgItem(IDC_BUT_NEW_DESC)->MoveWindow(rc);
	}
}
